#include "file_ctrl.h"
#include "storage_api.h"
#include "cross_com.h"

CFileInfo_manager::CFileInfo_manager()
{
	m_lstBufSz = 0;
	m_fileNum  = 0;
	m_pRetNum = NULL;
}

CFileInfo_manager::~CFileInfo_manager()
{

}

int CFileInfo_manager::Init(int maxFileNum)
{
	int ret    = 0;
	
	m_lstBufSz   = 4 + sizeof(FILE_RET_INFO) * maxFileNum;
	m_fileLstbuf = new char[m_lstBufSz];
	if(m_fileLstbuf == NULL)
	{
		fprintf(stderr,"File List new buf fail. \n");
		return ERR_DATA_BUF_EMPYT;
	}
	m_pRetNum = (int*)m_fileLstbuf;
	m_maxNum  = maxFileNum;
	return ret;
}

int CFileInfo_manager::GetFileLst(FILE_LST_REQ * fileReq)
{
	int ret = 0;
	char * pLstBuf = m_fileLstbuf + 4;
	m_fileNum = ret = SEARCH_REC_BY_PATHTYPE(pLstBuf,fileReq->number,fileReq->type,fileReq->pathDir);
	if( NULL != m_pRetNum)
	{
		*m_pRetNum = ret;
	}

	return ret;
}

int CFileInfo_manager::DelFile(FILE_DEL_INFO_REQ * pDelInfo)
{
	int ret = 0;


	return ret;
}

int CFileInfo_manager::GetSDCardStatus()
{
	int ret = 0;

	return ret;
}


